import { watch } from 'vue'
import {useAppStore} from '@/store/app.ts'
// import {i18n} from '@/main.ts'
import i18n from '@/i18n'

export function generateTitle(title) {
  return i18n.global.t('msg.route.' + title)
}


/**
 *
 * @param  {...any} cbs 所有的回调
 */
export function watchSwitchLang(...cbs) {
  let appStore = useAppStore()
  watch(
    () => appStore.language,
    () => {
      cbs.forEach(
        cb =>{
          return cb(appStore.language)
        }
      )
    }
  )
}
